# main.py
from db_compare.config import DBConfig
from clients.base import BaseClient
from compare import DatabaseComparator

# 配置数据库连接
mysql_config = DBConfig.from_env('MYSQL')
#pg_config = DBConfig.from_env('POSTGRESQL')
dm_config = DBConfig.from_env('DM')
# 打印配置以确认
#print("MySQL 配置:", mysql_config)
#print("PostgreSQL 配置:", pg_config)
mysql_client = BaseClient.create(mysql_config)
conn = mysql_client.get_conn()
#print(mysql_config.connect_args)
# 初始化对比器
comparator = DatabaseComparator(mysql_config, dm_config)

# 进行表结构对比
metadata_diff = comparator.compare_data()
print(metadata_diff)

# 进行数据对比
data_diff = comparator.compare_data(keys=['id'])
print(data_diff)
